// Fill out your copyright notice in the Description page of Project Settings.

#include "StHheartBeat.h"
#include <time.h>

FStHheartBeat::FStHheartBeat():tageTime(-1)
{

}

FStHheartBeat::~FStHheartBeat()
{

}


bool FStHheartBeat::SetTime(long wait)
{
	if (clock() < wait+1)
	{
		tageTime = wait;
		return true;
	}
	return false;
}

void FStHheartBeat::SetAddTime(long wait)
{
	tageTime = clock() + wait;
}

bool  FStHheartBeat::needTrigger() 
{
	long now = clock();
	if (tageTime > 0 && now >= tageTime)
	{
		tageTime = -1;
		return true;
	}
	return false;
}


long FStHheartBeat::GetNowTime() 
{
	return clock();
}